<?php

class Account extends Core_Controller {

    private $graph = 'https://graph.facebook.com';

    public function __construct() {
        parent::__construct();
        $this->load->model('account_model');
    }

    public function index() {        
        $account = $this->account_model->get($_SESSION['user_info']['facebook_id']);
        foreach ($account as $key => $value) {
            $account[$key]['image'] = $this->graph . '/' . $value['fb_id_map'] . '/picture';
            $link = $this->graph . '/' . $value['fb_id_map'];
            //$account_info = json_decode(file_get_contents($link), TRUE);            
            //$account[$key]['fullname'] = $account_info['name'];
        }
        
        $this->data['account'] = $account;
        $this->template->parse_view('content', 'frontend/account/index', $this->data);
        $this->template->render();
    }

}
